package com.gitee.feizns.wx.domain.props;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author feizns
 * @since 2019/7/15
 */
@Data
@ConfigurationProperties(prefix = "we-chat.config")
public class WeChatProperties {

    /**
     * 获取微信 access_token 请求链接
     */
    private String accessTokenUrl =
            "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";

    /**
     * js api 票据位置
     */
    private String jsApiTicketUrl =
            "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi";

    /**
     * js api 签名生成占位符
     */
    private String jsApiSignatureUrl =
            "jsapi_ticket={0}&noncestr={1}&timestamp={2}&url={3}";

    /**
     * 通过code换取网页授权access_token的url
     */
    private String authorizeUrl =
            "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code";

    /**
     * 如果网页授权作用域为snsapi_userinfo，则此时开发者可以通过access_token和openid拉取用户信息了。
     */
    private String authorizeUserInfoUrl =
            "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN";

    /**
     * 获取用户信息
     */
    private String userInfoUrl =
            "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";

}
